﻿using System;
using System.Collections;

namespace puerto_serie
{
    class ConvertidorNumeros
    {
        private int valueIn;
        public ConvertidorNumeros()
        {

        }
        public int setvalueIn
        {
            // set the value of the operand
            set { this.valueIn = value; }
            //get the value of operand
            get { return this.valueIn; }
        }
        public byte [] getBits(){
            BitArray b = new BitArray(new int[] { setvalueIn });
            byte[] bits2 = new byte[8];
            int k=7;

            for (int i = 0; i < 8; i++)
            {
                if (b[i])
                {
                    bits2[k] = 1;
                }
                else
                {
                    bits2[k] = 0;
                }
                k--;
            }
            for (int j=0; j < 8; j++)
            {
                Console.WriteLine(bits2[j]);
            }
            return bits2;

        }
    }
}
